<% layout('/layouts/default.html', {title: 'wx_business_user管理', libs: ['dataGrid']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header">
			<div class="box-title">
				<i class="fa fa-list-alt" id="businessName"></i> ${text('商家员工信息')}
			</div>
			<div class="box-tools pull-right">
				<!--<a href="#" class="btn btn-default" id="btnSearch" title="${text('查询')}"><i class="fa fa-filter"></i> ${text('查询')}</a>-->
				<% if(hasPermi('wx:wxBusinessUser:edit')){ %>
					<a href="${ctx}/wx/wxBusinessUser/form?businessId=${businessId}" class="btn btn-default btnTool" title="${text('新增wx_business_user')}"><i class="fa fa-plus"></i> ${text('新增员工')}</a>
				<% } %>
			</div>
		</div>
		<div class="box-body">
			<#form:form id="searchForm" model="${wxBusinessUser}" action="${ctx}/wx/wxBusinessUser/listData" method="post" class="form-inline hide"
					data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
				<div class="form-group">
					<label class="control-label">${text('商家id')}：</label>
					<div class="control-inline">
						<#form:input path="businessId" maxlength="20" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('关联的user表中的id')}：</label>
					<div class="control-inline">
						<#form:input path="userId" maxlength="20" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('关联的user表中的openid')}：</label>
					<div class="control-inline">
						<#form:input path="userOpenid" maxlength="200" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('员工姓名')}：</label>
					<div class="control-inline">
						<#form:input path="userName" maxlength="255" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('员工手机号')}：</label>
					<div class="control-inline">
						<#form:input path="phone" maxlength="200" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('备注')}：</label>
					<div class="control-inline">
						<#form:input path="remarks" maxlength="200" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('status')}：</label>
					<div class="control-inline width-120">
						<#form:select path="status" dictType="sys_search_status" blankOption="true" class="form-control"/>
					</div>
				</div>
				<div class="form-group">
					<button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>
					<button type="reset" class="btn btn-default btn-sm">${text('重置')}</button>
				</div>
			</#form:form>
			<table id="dataGrid"></table>
			<div id="dataGridPage"></div>
		</div>
	</div>
</div>
<% } %>
<script>
// 初始化DataGrid对象
$('#dataGrid').dataGrid({
	searchForm: $("#searchForm"),
	columnModel: [
		{header:'${text('商家名称')}', name:'businessName', index:'a.businessName', width:150, align:"center"},
		// {header:'${text('关联的user表中的openid')}', name:'userOpenid', index:'a.user_openid', width:150, align:"left"},
		{header:'${text('员工姓名')}', name:'userName', index:'a.user_name', width:150, align:"left"},
		// {header:'${text('userId')}', name:'userId', index:'a.user_id', width:150, align:"left"},
		// {header:'${text('浏览量')}', name:'userName', index:'a.user_name', width:150, align:"left"},
		// {header:'${text('购买量')}', name:'userName', index:'a.user_name', width:150, align:"left"},
		// {header:'${text('员工手机号')}', name:'phone', index:'a.phone', width:150, align:"left"},
		// {header:'${text('备注')}', name:'remarks', index:'a.remarks', width:150, align:"left"},
		{header:'${text('创建时间')}', name:'createDate', index:'a.create_date', width:150, align:"center"},
		// {header:'${text('status')}', name:'status', index:'a.status', width:150, align:"center", formatter: function(val, obj, row, act){
		// 	return js.getDictLabel(${@DictUtils.getDictListJson('sys_search_status')}, val, '${text('未知')}', true);
		// }},
		{header:'${text('操作')}', name:'actions', width:120, sortable:false, title:false, formatter: function(val, obj, row, act){
			var actions = [];
			<% if(hasPermi('wx:wxBusinessUser:edit')){ %>

                    actions.push('<a href="${ctx}/wx/wxBusinessUserTongji/?id='+row.id+'" class="btnList" title="${text('查看员工统计')}"><i class="fa fa-pencil">查看员工统计</i></a>&nbsp;');
                    actions.push('<a href="${ctx}/wx/wxBusinessUser/delete?id='+row.id+'" class="btnList" style="margin-left: 100px;" title="${text('删除商家员工')}" data-confirm="${text('确认要删除该员工吗？')}"><i class="fa fa-trash-o"></i></a>&nbsp;');

                    // actions.push('<a href="${ctx}/wx/wxUserDisValue/form?id='+row.id+'" class="btnList" title="${text('查看员工统计')}"><i class="fa fa-pencil">查看员工统计</i></a>&nbsp;');
				// actions.push('<a href="${ctx}/wx/wxBusinessUser/delete?id='+row.id+'" class="btnList" title="${text('删除商家员工')}" data-confirm="${text('确认要删除该员工吗？')}"><i class="fa fa-trash-o"></i></a>&nbsp;');
			<% } %>
			return actions.join('');
		}}
	],
	// 加载成功后执行事件
	ajaxSuccess: function(data){
		console.log(data)
		if(data.pageInfo) {
            $('#businessName').html(data.pageInfo)
        }
	}
});
</script>